{% extends '@WebsiteBundle/layout/baselayout.html.twig' %}
{% import "@WebsiteBundle/macros/pagination.html.twig" as macros %}
{% block seo_title %}
	{{ seoTitle }}
{% endblock %}
{% block seo_descr %}
	{{ seoDescr }}
{% endblock %}
{% block seo_kw %}
	{{ seoKw }}
{% endblock %}
{% block body_main %}
	{{ parent() }}
	<div class="page">
		{{ render(path('app_header', {"route":route})) }}
		<div class="navbar-expand-md">
			<div class="navbar navbar-light">
				<div class="container-xl">

					<ul class="nav nav-pills">
						<li class="nav-item">
							<a class="nav-link {% if 0 == category %} active {% endif %}" aria-current="page" href="{{ path('app_news') }}">全部</a>
						</li>
						{% if newsCategory %}
							{% for item in newsCategory %}
								<li class="nav-item">
									<a class="nav-link {% if item['id'] == category %} active {% endif %}" href="{{ path('app_news', {category:item['id'], topValue:topValue}) }}">{{item['name']}}</a>
								</li>
							{% endfor %}
						{% endif %}
					</ul>


				</div>
			</div>
		</div>
		<div class="page-wrapper">
			<div class="page-body">
				<div class="container-xl">
					<div class="row row-deck row-cards">
						<div class="col-sm-12 col-lg-8 vh-70">
							<div class="card">
								<div class="card-body">
									<ul class="nav nav-bordered mb-1">
										<li class="nav-item">
											<a class="nav-link {% if topValue == 0 %} active {% endif %}" aria-current="page" href="{{ path('app_news', {category:category, topValue:0}) }}">最新</a>
										</li>
										<li class="nav-item">
											<a class="nav-link {% if topValue == 1 %} active {% endif %}" href="{{ path('app_news', {category:category, topValue:1}) }}">最热</a>
										</li>
										<li class="nav-item">
											<a class="nav-link {% if topValue == 2 %} active {% endif %}" href="{{ path('app_news', {category:category, topValue:2}) }}">精选</a>
										</li>
									</ul>
									<div class="row row-deck row-cards">
										{% if list %}
											{% for item in list %}
												{% if item['img'] %}
													<div class="col-sm-12 col-lg-12">
														<div class="card card-sm card-borderless border-bottom pb-1">
															<div class="row row-0">
																<div class="col-3 order-md-last">
																	<img src="{{ json_get(item['img']) }}" class="w-100 h-100 object-cover card-img-start" alt="{{ item['title'] }}">
																</div>
																<div class="col">
																	<div class="card-body p-1">
																		<h3 class="card-title d-flex w-100 justify-content-between mt-1">
																			<a href="{{ path('app_news_detail', {id:item['id']}) }}" class="h3 tracking-wide mb-1">{{ item['title'] }}</a>
																			<small class="text-muted ps-2">{{ item['createdAtTime']|qtime }}</small>
																		</h3>
																	</div>
																</div>
															</div>
														</div>
													</div>
												{% else %}
													<div class="col-sm-12 col-lg-12">
														<div class="card  card-sm card-borderless border-bottom pb-1">
															<div class="row row-0">
																<div class="col-auto">
																	<div class="card-body p-1">
																		<h3 class="card-title d-flex w-100 justify-content-between mt-1">
																			<a href="{{ path('app_news_detail', {id:item['id']}) }}" class="h3 tracking-wide mb-1">{{ item['title'] }}</a>
																			<small class="text-muted ps-2">{{ item['createdAtTime']|qtime }}</small>
																		</h3>
																	</div>
																</div>
															</div>
														</div>
													</div>
												{% endif %}
											{% endfor %}
											<div class="col-sm-12 col-lg-12 pagination ">
												{{ macros.pagination(pagination) }}
											</div>
										{% else %}
											{% include '@WebsiteBundle/empty.html.twig' %}
										{% endif %}
									</div>
								</div>
							</div>
						</div>

						<div class="col-sm-12 col-lg-4 d-none d-md-block">
							<div class="row row-cards">
								<div class="col-12">
									<div class="card" style="height:120px;">
										<div class="card-header">
											<h2 class="card-title">
												<strong>每日一言</strong>
											</h2>
										</div>
										<div class="card-body">
											<div class="text-muted tracking-wide">{{ oneSentenceADay }}</div>
										</div>
									</div>
								</div>
								<div class="col-12">
									<div class="card">
										<div class="card-header">
											<h2 class="card-title">
												<strong>公告</strong>
											</h2>
										</div>
										<div class="card-body">
											{% if notices %}
												{% for item in notices %}
													<p class="tracking-wide h5">
														<a href="{{ path('app_news_detail', {id: item['id']}) }}">{{ item['title'] }}</a>
													</p>
												{% endfor %}
											{% else %}
												{% include '@WebsiteBundle/empty.html.twig' %}
											{% endif %}
										</div>
									</div>
								</div>
							</div>
						</div>
					</div>
				</div>
			</div>
		</div>
		{{ render(path('app_footer')) }}
	</div>
{% endblock %}
